#include <stdio.h>

void decimal_to_binary(int n, char *binary) {
    int i; 
	for ( i = 0; i < 11; i++) {
        binary[i] = ((n >> (10 - i)) & 1) ? '1' : '0';
    }
    binary[11] = '\0';
}

int main() {
    int input;
    scanf("%d", &input);

    char hamming[12];
    decimal_to_binary(input, hamming);

    int s1 = (hamming[10] - '0') ^ (hamming[8] - '0') ^ (hamming[6] - '0') 
            ^ (hamming[4] - '0') ^ (hamming[2] - '0') ^ (hamming[0] - '0');
    int s2 = (hamming[9] - '0') ^ (hamming[8] - '0') ^ (hamming[5] - '0') 
            ^ (hamming[4] - '0') ^ (hamming[1] - '0') ^ (hamming[0] - '0');
    int s3 = (hamming[7] - '0') ^ (hamming[6] - '0') ^ (hamming[5] - '0') 
            ^ (hamming[4] - '0');
    int s4 = (hamming[3] - '0') ^ (hamming[2] - '0') ^ (hamming[1] - '0') 
            ^ (hamming[0] - '0');

    int pos = (s4 << 3) | (s3 << 2) | (s2 << 1) | s1;

    if (pos != 0) {
        int index = 11 - pos; 
        hamming[index] = (hamming[index] == '0') ? '1' : '0';
    }


    char data[8] = {
        hamming[0],  
        hamming[1],  
        hamming[2],  
        hamming[4],  
        hamming[5],  
        hamming[6],  
        hamming[8],  
        '\0'
    };

    printf("%s\n", data);

    return 0;
}
